﻿//  --------------------------------
//  Copyright (c) AW Systems, Inc. All rights reserved.
//  This source code is made available under the terms of the Microsoft Public License (Ms-PL)
//  http://www.codeplex.com/SLAM/license
//  ---------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Slam.Data
{
    public interface IDataServices
    {
        /// <summary>
        /// Creates a new row in the association table for the given association type with the given ids.
        /// </summary>
        /// <param name="associationTypeName"></param>
        /// <param name="firstId"></param>
        /// <param name="secondId"></param>
        /// <returns></returns>
        bool Associate(string associationTypeName, string firstTypeName, string firstId, string secondTypeName, string secondId);

        bool Associate(string associationTypeName, string firstTypeName, string firstId, string secondTypeName, string secondId, params object[] extendedParameters);

        /// <summary>
        /// Deletes a row in the table for the typeName with the given id
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="values"></param>
        /// <returns></returns>
        bool Delete(string typeName, string id);

        bool Delete(string typeName, string id, params object[] extendedParameters);

        /// <summary>
        /// Deletes all associations of the given association type for the given type and id.
        /// </summary>
        /// <param name="associationTypeName"></param>
        /// <param name="typeName"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        bool DeleteAllAssociations(string associationTypeName, string typeName, string id);

        bool DeleteAllAssociations(string associationTypeName, string typeName, string id, params object[] extendedParameters);

        /// <summary>
        /// Delete the association of the given association type for the given ids.
        /// </summary>
        /// <param name="associationTypeName"></param>
        /// <param name="firstId"></param>
        /// <param name="secondId"></param>
        /// <returns></returns>
        bool DeleteAssociation(string associationTypeName, string firstTypeName, string firstId, string secondTypeName, string secondId);

        bool DeleteAssociation(string associationTypeName, string firstTypeName, string firstId, string secondTypeName, string secondId, params object[] extendedParameters);

        /// <summary>
        /// Inserts a new row into the table for the typeName with the Hashtable of field names and values.
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="values"></param>
        /// <returns></returns>
        bool Insert(string typeName, Hashtable values);

        bool Insert(string typeName, Hashtable values, params object[] extendedParameters);

        /// <summary>
        /// Updates a row in the table for the typeName of the given with id with the Hashtable of field names and values.
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="id"></param>
        /// <param name="values"></param>
        /// <returns></returns>
        bool Update(string typeName, string id, Hashtable values);

        bool Update(string typeName, string id, Hashtable values, params object[] extendedParameters);
    }
}
